<%@ page language="java" pageEncoding="UTF-8"
	import="java.util.*,java.io.*,com.knife.tools.ZipUtil,com.knife.util.CommUtil"%>
<%@ page import="com.knife.news.logic.*,com.knife.news.logic.impl.*"%>
<%@ page import="com.knife.news.object.Custom"%>
<%@ include file="checkUser.jsp"%><html>
	<head>
		<title>KnifeCMS解压文件</title>
		<style>
body {
	font-size: 12px;
	background: black;
	color: white;
}
</style>
	</head>
	<body>
		<%
			String id = "";
			if (request.getParameter("id") != null) {
				id = request.getParameter("id");
			}
			if (id.length() > 0) {
				CustomService customDAO = CustomServiceImpl.getInstance();
				Custom custom = customDAO.getCustomById(id);
				custom.setStatus(1);
				customDAO.updateCustom(custom);
				ZipUtil z = new ZipUtil();
				//System.out.println("解压文件:"+custom.getFile().getAbsolutePath());
				//String dirName=custom.getFile().getName();
				//dirName=dirName.substring(0,dirName.indexOf("."));
				//System.out.println("解压到:"+custom.getFile().getParentFile().getAbsolutePath()+"/"+dirName);
				z.ReadZip(custom.getFile().getAbsolutePath(), custom.getFile().getParentFile().getAbsolutePath());
				File pubFile=new File(custom.getFile().getAbsolutePath().replace("html", "wwwroot"));
				if(pubFile.exists()){
					try{
						z.ReadZip(pubFile.getAbsolutePath(), pubFile.getParentFile().getAbsolutePath());
					}catch(Exception e){}
				}
				out.println("[解压文件]" + custom.getUrl() + "<br/>");
				out.println("<script>document.body.scrollTop=document.body.scrollHeight;</script>");
				out.flush();
				out.println("解压完毕！");
				out.println("<script>document.body.scrollTop=document.body.scrollHeight;</script>");
			}
		%>
	</body>
</html>